
package com.work.pdf;

import java.util.List;

import com.itextpdf.text.*;
import com.itextpdf.text.pdf.*;

public class PdfTableDecorator extends PdfDecorator {

	private PdfPTable table;
	private List<PdfPCell> cells;
	
	private PdfTableDecorator(Document document) {
		super(document);
	}
	
	public PdfTableDecorator(Document document, int columns, List<PdfPCell> cells) {
		super(document);
		this.cells = cells;
		this.table = new PdfPTable(columns);
	}

	@Override
	public void decorate() throws DocumentException {
		table.setWidthPercentage(100f);
		
		for (PdfPCell cell : cells) {
			table.addCell(cell);
		}
		
		document.add(table);
	}
	
	public void setBorder() {
		
	}
}
